package com.yidu.t299.service.xp.impl;
import com.yidu.t299.dao.xp.StudentChangeMapper;
import com.yidu.t299.domain.xp.Class;
import com.yidu.t299.domain.xp.Record;
import com.yidu.t299.domain.xp.School;
import com.yidu.t299.domain.xp.StudentChange;
import com.yidu.t299.service.xp.StudentChangeBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

/**
 * @descripion:
 * @auth: XuPan
 * @date: 2023/3/10 10:19
 * @version: 1.0
 */
@Service
@Transactional
public class StudentChangeBizImpl implements StudentChangeBiz {
    @Autowired
    private StudentChangeMapper studentChangeMapper;//注入数据


    @Override
    public int deleteByPrimaryKey(Integer studentchangeId) {
        return studentChangeMapper.deleteByPrimaryKey(studentchangeId);
    }

    @Override
    public int insert(StudentChange record) {
        return studentChangeMapper.insert(record);
    }

    @Override
    public StudentChange selectByPrimaryKey(Integer studentchangeId) {
        return studentChangeMapper.selectByPrimaryKey(studentchangeId);
    }

    @Override
    public List<StudentChange> selectByPage(int rows, int page, String condition) {
        return studentChangeMapper.selectByPage(rows, page, condition);
    }


    @Override
    public int selectCount(String condition) {
        return studentChangeMapper.selectCount(condition);
    }

    @Override
    public int updateByPrimaryKey(StudentChange record) {
        return studentChangeMapper.updateByPrimaryKey(record);
    }

    @Override
    public String getCondition(StudentChange studentChange) {
        // 定义条件字符串变量，初始值为空格字符串
        String condition = " ";
        //如果转班对象为空则直接返回条件字符串
        if (studentChange == null){
            return condition;
        }
        if (studentChange.getStudentName() != null && studentChange.getStudentName().trim().length()!=0){
            condition += " and student_name like '%" + studentChange.getStudentName() + "%'";
        }
        //返回条件字符串
        return condition;
    }

    @Override
    public List<School> selectAllGetSchoolName() {
        return studentChangeMapper.selectAllGetSchoolName();
    }

    @Override
    public List<Record> selectAllGetRecordName() {
        return studentChangeMapper.selectAllGetRecordName();
    }

    @Override
    public List<Class> selectAllGetClassName() {
        return studentChangeMapper.selectAllGetClassName();
    }


    @Override
    public int selectByStudentName(String studentName) {
        return studentChangeMapper.selectByStudentName(studentName);
    }

    @Override
    public int selectBySchoolName(String schoolName) {
        return studentChangeMapper.selectBySchoolName(schoolName);
    }

    @Override
    public int selectByClassName(String className) {
        return studentChangeMapper.selectByClassName(className);
    }

    @Override
    public int selectByRecordName(String recordName) {
        return studentChangeMapper.selectByRecordName(recordName);
    }

}
